package jee.boot.entity.auth;

import jee.boot.common.annotation.Column;
import jee.boot.common.annotation.Table;
import jee.boot.entity.system.BasicSbj;
import jee.boot.entity.system.GeneralDataEntity;

/**
 * 权限主体聚合
 */
@Table(name = "at_r_sbj_aggr")
public class SbjAggr extends GeneralDataEntity<SbjAggr> {

    private static final long serialVersionUID = 1L;

    /**
     * 权限主体聚合类型
     */
    @Column(name = "st_r_sbj_aggr_type")
    private String sbjAggrType;//字典：
    /**
     * 主体类型
     */
    @Column(name = "st_sbj_type")
    private String sbjType;//字典：DIC_AUTH_AuthSbjType,只能取值为'DIC_AUTH_AuthSbjType_01'（User用户）或'DIC_AUTH_AuthSbjType_02'（Group用户组）
    /**
     * 主体ID
     */
    @Column(name = "st_sbj_id", joinTable = false)
    private BasicSbj sbj;//引用：AT_USER、AT_GROUP,具体引用哪个表取决于ST_SBJ_TYPE值
    /**
     * 客体类型
     */
    @Column(name = "st_obj_type")
    private String objType;//字典：DIC_AUTH_AuthSbjType,只能取值为'DIC_AUTH_AuthSbjType_02'（Group用户组）或'DIC_AUTH_AuthSbjType_03'（Role角色）
    /**
     * 客体ID
     */
    @Column(name = "st_obj_id", joinTable = false)
    private BasicSbj obj;//引用：AT_GROUP、AT_ROLE,具体引用哪个表取决于ST_OBJ_TYPE值

    public SbjAggr() {
    }

    public SbjAggr(String id) {
        super(id);
    }

    public SbjAggr(String sbjType, BasicSbj sbj, String objType, BasicSbj obj) {
        this.sbjType = sbjType;
        this.sbj = sbj;
        this.objType = objType;
        this.obj = obj;
    }

    public String getSbjAggrType() {
        return sbjAggrType;
    }

    public void setSbjAggrType(String sbjAggrType) {
        this.sbjAggrType = sbjAggrType;
    }

    public String getSbjType() {
        return sbjType;
    }

    public void setSbjType(String sbjType) {
        this.sbjType = sbjType;
    }

    public BasicSbj getSbj() {
        return sbj;
    }

    public void setSbj(BasicSbj sbj) {
        this.sbj = sbj;
    }

    public String getObjType() {
        return objType;
    }

    public void setObjType(String objType) {
        this.objType = objType;
    }

    public BasicSbj getObj() {
        return obj;
    }

    public void setObj(BasicSbj obj) {
        this.obj = obj;
    }

    public static void main(String[] args) {
        System.out.println(new SbjAggr().getFindListSql());
    }
}
